<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<script type="text/javascript" src="scripts/boot.js"></script>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
    <table style="width:100%;">
        <tr>
        	<td style="width:100%;">
        		<span style="margin-left:10px;">用户名称(模糊)：</span><input id="s_name" class="mini-textbox" emptyText="用户名称(模糊)" style="width:150px;margin-right:10px;" />
				<span style="margin-left:68px;">休假类型(精确)：</span>
				<div id="s_types" class="mini-combobox" style="width:150px;margin-left:-5px;"  popupWidth="165" textField="keyValue" valueField="keyName" 
				    url="dictionary_key_val_view.do?typeName=LEAVE_TYPE" multiSelect="true"  showClose="true" oncloseclick="onCloseClick" >     
				    <div property="columns">
				        <div header="类型(精确)" field="keyValue"></div>
				    </div>
				</div>
            </td>
            <td style="white-space:nowrap;">
               	<a class="mini-button" iconCls="icon-search" onclick="search()">查询</a>
           	</td>
        </tr>
    </table>           
</div>
<div class="mini-fit" >
    <div id="datagrid1" class="mini-datagrid " idField="id" pageSize="20"
		url="leave_approve_all_view.do" 
		style="width:100%;height:100%;" allowCellSelect="true" multiSelect="true">
		<div property="columns">
			<div type="indexcolumn" headerAlign="center">#</div>
			<div field="name" width="100" headerAlign="center" align="center">用户名</div>
			<div field="leaveTypeName" width="100" headerAlign="center" align="center">休假类型</div>
			<div field="startTime" width="100" allowSort="true" headerAlign="center" align="center">休假开始时间</div>
			<div field="endTime" width="100" allowSort="true" headerAlign="center" align="center">休假结束时间</div>
			<div field="days" width="100" headerAlign="center" align="center">休假天数</div>
			<div width="120" headerAlign="center" align="center" renderer="onActionRenderer">相关操作</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	mini.parse();
	var grid = mini.get("datagrid1");
	grid.reload();
	
	//查询
	function search() {
	    var name = mini.get("s_name").getValue();
	    var types = mini.get("s_types").getValue();
	    grid.load({ name: name,
	    	leaveType: types,
	    });
	}
	
	function onActionRenderer(e) {
	    var s = "<a href='javascript:seeDetails();'>查看详细</a>";
	    return s;
	}
	
	//查看详情
	function seeDetails() {
	    var row = grid.getSelected();
	    if (row) {
	        mini.open({
	            url: "init_leave_details.do",
	            allowResize:false,
	            title: "休假单信息", width: 500, height: 430,
	            onload: function () {
	                var iframe = this.getIFrameEl();
	                var data = { row: row };
	                iframe.contentWindow.SetData(data);
	            }
	        });
	        
	    }
	}
	
	function onCloseClick(e) {
        var obj = e.sender;
        obj.setText("");
        obj.setValue("");
    }
	
</script>
</body>
</html>